<?php
/**
 * @package Joomla
 * @subpackage Component
 * @license GNU/GPL
 * @author Joomlart.com
 * @version 1.0
 */
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();

jimport( 'joomla.application.component.view' );

/**
 * News View
 * @package Joomlart
 * @subpackage Components
 */
class JanewsViewCommon extends JView 
{
  function display($tpl = null)
  {
    if($this->getLayout() == 'config') {
			$this->_displayConfig($tpl);
			return;
		}
		$controller = JRequest::getVar('controller');
		$group = JRequest::getVar('group');
		$this->assignRef('controller',$controller);
		$this->assignRef('group',$group);
    parent::display($tpl);
  }
  
  function _displayConfig($tpl)
  {
    $document = & JFactory::getDocument();
		$document->setTitle( JText::_('GLOBAL CONFIGURATION') );
		JToolBarHelper::title( JText::_( 'GLOBAL CONFIGURATION' ), 'generic.png' );
    JToolBarHelper::save();;
    JToolBarHelper::cancel('cancel','Close');
    JHTML::_('behavior.tooltip');
		JHTML::_('behavior.switcher');

		// Load component specific configurations
		
		/*$params = new JParameter( $tblcomponent->params, JPATH_ADMINISTRATOR.DS.'components'.DS.'com_janews'.DS.'config.xml' );
		$params = $params->getParams();
		$params = $params[1];*/
		
		$model = $this->getModel();
		$model->init();
		$component =& JComponentHelper::getComponent('com_janews');
	  $menu = $model->checkComponentMenu($component->id)? 0 : 1;
	  $homepage = $model->checkComHomePage($component->id);
	  $enabled = $component->enabled;
		  
		//$this->assignRef('params',$params);
		$this->assignRef('menu',$menu);
		$this->assignRef('homepage',$homepage);
		$this->assignRef('enabled',$enabled);
    parent::display($tpl);
  }
}
?>